﻿@model ManageLoginsViewModel
@{
    ViewBag.Title = "Manage your external logins";
}

<h2>@ViewBag.Title.</h2>

<p class="text-success">@ViewBag.StatusMessage</p>
@if (Model.CurrentLogins.Count > 0)
{
    <h4>Registered Logins</h4>
    <table class="table">
        <tbody>
        @foreach (var account in Model.CurrentLogins)
        {
            <tr>
                <td>@account.LoginProvider</td>
                <td>
                    @if (ViewBag.ShowRemoveButton)
                    {
                        <form asp-controller="Manage" asp-action="RemoveLogin" method="post" class="form-horizontal" role="form">
                            <div>
                                <input asp-for="@account.LoginProvider" type="hidden" />
                                <input asp-for="@account.ProviderKey" type="hidden" />
                                <input type="submit" class="btn btn-default" value="Remove" title="Remove this @account.LoginProvider login from your account" />
                            </div>
                        </form>
                    }
                    else
                    {
                        @: &nbsp;
                    }
                </td>
            </tr>
        }
        </tbody>
    </table>
}
@if (Model.OtherLogins.Any())
{
    <h4>Add another service to log in.</h4>
    <hr />
    <form asp-controller="Manage" asp-action="LinkLogin" method="post" class="form-horizontal" role="form">
        <div id="socialLoginList">
            <p>
                @foreach (var p in Model.OtherLogins)
                {
                    <button type="submit" class="btn btn-default" id="@p.Name" name="provider" value="@p.Name" title="Log in using your @p.Name account">@p.Name</button>
                }
            </p>
        </div>
    </form>
}